﻿using Zavand.Web.Mvc.Manana.Framework;

namespace Zavand.Web.Mvc.Manana.SampleWebsite.Areas.Area1.Controllers.Default.Actions.Index
{
    public class Route:DefaultControllerRoute,IPageableOptional
    {
        public Route()
        {
            Action = DefaultController.ActionNameIndex;
        }

        public int? Page { get; set; }
        public int? PageSize { get; set; }

        public override string GetUrl()
        {
            return base.GetUrl() + "/{page}/{pagesize}";
        }
        public override object GetDefaults()
        {
            return new
                       {
                           Area,
                           Controller,
                           Action,
                           Page = 1,
                           PageSize=10
                       };
        }
        public override void MakeTheSameAs(BaseRoute r)
        {
            base.MakeTheSameAs(r);
            var o = r as Route;
            if (o == null)
                return;
            Page = o.Page;
            PageSize = o.PageSize;
        }
    }
}